package com.lutzyt.delivery.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lutzyt.delivery.service.AuditService;
import com.lutzyt.delivery.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;

/**
 * @Author: zyt
 */
public class AuditController<S extends AuditService<T>,T>{

  @Autowired
  protected S auditService;

  @PostMapping("/audit/page")
  public Result<Page<T>> page(Integer pageSize, Integer pageNum){
    final Page<T> page = auditService.auditPage(pageNum, pageSize);
    return Result.success(page);
  }
  @PutMapping("/{id}/audit/pass")
  public Result<Void> pass(@PathVariable String id){
    auditService.pass(id);
    return Result.success();
  }

  @PutMapping("/{id}/audit/noPass")
  public Result<Void> noPass(@PathVariable String id){
    auditService.noPass(id);
    return Result.success();
  }

}
